<?php
		namespace Admin\Controller;

		class OrderController extends CommonController{

			public function index(){

				$model = D('OrderList');
				$res=$model->getAll();

				//发送订单编号数据 前台遍历
				$this->assign('res',$res);
				// var_dump($res);
				$this->display();
			}

			//后台发货
			public function show(){

				$id = $_GET['id'];

				$model = M('order_list');

		        $data['is_show'] = 1;
		        $show = $model->where('id='.$id)->save($data);
		        if ($show) 
		        {
		         	$this->redirect('Order/index');
		         } 
			}

			//删除订单
			public function delete(){

				$id = $_GET['id'];

				$model = M('order_list');
				$res=$model->field('is_show,is_fu')->where('id='.$id)->find();

				//只有在客户签收 或 客户没付款的时候才能取消订单
		       if ($res['is_show'] == 2 || $res['is_fu'] == 0) {
		       	$show = $model->where('id='.$id)->delete();
		        if ($show) 
		        {
		         	$this->redirect('Order/index');
		        } 
		       }
			}	


		}